package iss.anxios.dao;

import iss.anxios.dto.MenuItem;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository("menuitemdao")
public class MenuItemDaoImpl implements MenuItemDao{

	@PersistenceContext
	EntityManager em;
	
	public void SaveMenuItem(MenuItem menuItem){
		em.persist(menuItem);
	}
	
	@Transactional
	@SuppressWarnings("unchecked")
	public List<MenuItem> GetAllMenuItems() {
		return em.createQuery("select menu from MenuItem menu").getResultList();
	}

	@Override
	public void remove(MenuItem menuItem) {
	}

	@Override
	public MenuItem GetMenuItemByID(int id) {
		return null;
	}

}
